package etnorservice.etnor_service.mapper;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: cc
 * @Date: 2024/08/29/17:18
 **/
import etnorservice.etnor_service.domain.po.ApiThreshold;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ApiThresholdMapper {

    @Insert("INSERT INTO api_threshold (api_name, threshold, created_at, updated_at) VALUES (#{apiName}, #{threshold}, NOW(), NOW())")
    void insertThreshold(ApiThreshold apiThreshold);

    @Update("UPDATE api_threshold SET threshold = #{threshold}, updated_at = NOW() WHERE apiid = #{apiid}")
    void updateThreshold(ApiThreshold apiThreshold);

    @Select("SELECT * FROM api_threshold WHERE apiid = #{apiid}")
    ApiThreshold getThresholdByName(Long apiid);

    @Delete("DELETE FROM api_threshold WHERE apiid = #{apiid}")
    void deleteThresholdByName(Long apiid);
}

